package com.pubinfo.passbook.common.service.contract.impl;


import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pubinfo.passbook.common.entity.TContractWriteoffItems;
import com.pubinfo.passbook.common.mapper.TContractWriteoffItemsMapper;

import com.pubinfo.passbook.common.model.dto.contract.PwParam;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.service.contract.TContractWriteoffItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;

/**
 * @author 全
 * @description 针对表【t_contract_writeoff_items(报账单-行项目信息)】的数据库操作Service实现
 * @createDate 2021-12-07 15:23:17
 */
@Service
public class TContractWriteoffItemsServiceImpl extends ServiceImpl<TContractWriteoffItemsMapper, TContractWriteoffItems>
        implements TContractWriteoffItemsService {
    @Resource
    private TContractWriteoffItemsMapper tContractWriteoffItemsMapper;

    //挑对金额
    @Override
    public JsonResult<String> saveWriteoffItems(PwParam params) {
        if (CollUtil.isEmpty(params.getPickListParams())) {
            return null;

        }
        for (TContractWriteoffItems pickListParam : params.getPickListParams()) {
          tContractWriteoffItemsMapper.insert(pickListParam);
        }


        return JsonResult.success("操作成功");
    }
}